#ifndef INCLUDED_ENEMY_H
#define INCLUDED_ENEMY_H

//====================================================================================================
// Includes
//====================================================================================================

#include <SGE.h>
using namespace SGE;

#include "EnemyState.h"
#include "Map.h"

//====================================================================================================
// Enums
//====================================================================================================

enum eAnimationState
{
	eAS_None = -1,
	eAS_Idle,
	eAS_Walk,
	eAS_Jump,
	eAS_Fall,
	eAS_Max
};

//====================================================================================================
// Class Declarations
//====================================================================================================

class Enemy
{
public:
	Enemy();
	~Enemy();

	void Load(int level);
	void Unload();
	void Update(float deltaTime, const Map& map);
	void Render(const SVector2& offset);

	void Spawn(const SVector2& pos);
	void Kill();

	bool IsActive() const { return mActive; };

	void ChangeState(eAnimationState as);
	const char* GetCurrentState();

	SRect GetBoundingBox() const;
	SCircle GetBoundingCircle()  const { return SCircle(SVector2(mPosition.x, (mPosition.y - 65.0f)), 35.0f); }

	// Accessors
	const SVector2& GetPosition() const		{ return mPosition; }
	const SVector2& GetVelocity() const		{ return mVelocity; }
	bool IsFacingLeft() const				{ return mFacingLeft; }

	// Mutators
	void SetPosition(const SVector2& pos)	{ mPosition = pos; }
	void SetVelocity(const SVector2& vel)	{ mVelocity = vel; }
	void SetFacingLeft(bool facingLeft)		{ mFacingLeft = facingLeft; }

private:
	void CheckCollision(float deltaTime, const Map& map);

	EnemyState* mEnemyStates[eAS_Max];
	EnemyState* mpCurrentState;

	SVector2 mPosition;
	SVector2 mVelocity;

	bool mFacingLeft;
	bool mActive;
};

#endif // #ifndef INCLUDED_CHARACTER_H